home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 August / August CD.bin / Shareware / Education / numericalmethods Folder / chap_11 / a11_4.m < prev    next >
Encoding:
Text File  |  1994-06-05  |  1.6 KB  |  59 lines  |  [MATS/MATL]

  1. echo off;
  2. % NUMERICAL METHODS: MATLAB Programs, (c) John H. Mathews 1994
  3. % To accompany the text:
  4. % NUMERICAL METHODS for Mathematics, Science and Engineering, 2nd Ed, 1992
  5. % Prentice Hall, Englewood Cliffs, New Jersey, 07632, U.S.A.
  6. % This free software is complements of the author.
  7.  
  8. % Algorithm 11.4 (Reduction to Tridiagonal Form).
  9. % Section    11.4,    Eigenvalues of Symmetric Matrices, Page 581
  10. echo on; clc; format long; hold off; clear
  11.  
  12. % HOUSEHOLDER`S  METHOD
  13.  
  14. %   Assume that A is an n by n real symmetric matrix.
  15.  
  16. % Then A is similar to a tridiagonal matrix.
  17.  
  18. % Starting with  A  = A, Householder`s method will
  19. %                 0
  20.  
  21. % construct a sequence of orthogonal symmetric matrices
  22.  
  23. % {P } such that A  = P  A    P  ,
  24. %   k             k    k  k-1  k
  25.  
  26. %            for  k = 1,2,...,n-2.
  27.  
  28. % Then  B = A    is the desired tridiagonal matrix.
  29. %            n-2
  30.  
  31. % Remark. house.m is used for Algorithm 11.4
  32.  
  33. pause % Press any key to continue.
  34.  
  35. clc;
  36. %     We will now proceed with Householder`s method of iteration
  37. %  to find the tridiagonal matrix  A    that is similar to  A.
  38. %                                   n-2
  39.  
  40. % Place the symmetric n by n matrix in  A.
  41.  
  42. A = [4    2    2    1;
  43.      2   -3    1    1;
  44.      2    1    3    1;
  45.      1    1    1    2];
  46.  
  47. B = house(A,1);
  48.  
  49. pause % Press any key to continue.
  50.  
  51. clc;
  52. Mx1 = 'Implementation of Householder`s reduction to tridiagonal form.';
  53. Mx2 = 'The matrix  A  is:';
  54. Mx3 = 'The similar tridiagonal matrix is:';
  55. clc,echo off,diary output,...
  56. disp(' '),disp(Mx1),disp(' '),disp(Mx2),...
  57. disp(A),disp(Mx3),disp(B),...
  58. diary off,echo on
  59.